﻿@namespace BootstrapBlazor.Components
@inherits BootstrapComponentBase

<div class="@ClassName" role="document" @ref="DialogElement">
    <div class="modal-content">
        <div class="modal-header">
            @if (HeaderTemplate != null)
            {
                @HeaderTemplate
            }
            else
            {
                <h5 class="modal-title flex-fill">@Title</h5>
            }
            @if (ShowPrintButton && ShowPrintButtonInHeader)
            {
                <PrintButton Color="Color.Primary" class="btn-print" Text="@PrintButtonText" />
            }
            @if (ShowMaximizeButton)
            {
                <Button Color="Color.None" class="btn-maximize" aria-label="@MaximizeAriaLabel" OnClick="@OnToggleMaximize" Icon="@MaximizeIcon"></Button>
            }
            @if (ShowHeaderCloseButton)
            {
                <Button Color="Color.None" class="btn-close" aria-label="Close" OnClickWithoutRender="@OnClickClose"></Button>
            }
        </div>
        <CascadingValue Name="BodyContext" Value="@BodyContext" IsFixed="true">
            <div class="modal-body">
                @BodyTemplate
            </div>
            @if (ShowFooter)
            {
                <div class="modal-footer">
                    @if (ShowCloseButton)
                    {
                        <Button Color="Color.Secondary" Text="@CloseButtonText" Icon="fa fa-times" OnClickWithoutRender="OnClickClose" />
                    }
                    @if (ShowPrintButton && !ShowPrintButtonInHeader)
                    {
                        <PrintButton Color="Color.Primary" class="btn-print" Text="@PrintButtonText" />
                    }
                    @if (ShowSaveButton)
                    {
                        <Button Color="Color.Primary" Text="@SaveButtonText" Icon="fa fa-save" OnClickWithoutRender="OnClickSave" />
                    }
                    @FooterTemplate
                </div>
            }
        </CascadingValue>
    </div>
</div>
